<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // onkeyup 某个键被松开时触发

        // document.onkeyup=function(){
        //     console.log('我弹起来了。。。');
        // }
        document.addEventListener('keyup',function(){
            console.log('我弹起来了。。。');
        })


        // onkeydown 某个键被按下时触发
        document.addEventListener('keydown',function(){
            console.log('我按下了down。。。');
        })

        // onkeypress 某个键被按下时触发 不能识别功能键 比如 Ctrl shift
        document.addEventListener('keypress',function(){
            console.log('我按下了press。。。');
        })

        // 三个事件的执行顺序是 keydown-->keypress-->keyup
    </script>
</body>
</html>